const tools = require("../../utils/tools");

Component({
    options: {
        multipleSlots: true
    },
    /**
     * @property {Boolean} xslot 是否自定义中心区域
     * @property {String} title 标题
     * @property {String} mode 整体模型朝向 left/center 默认left
     */
    properties: {
        xslot: {
            type: Boolean,
            value: false
        },
        title: {
            type: String,
            value: "悦己抒心"
        },
        mode: {
            type: String,
            value: "center"
        },
        home: {
            type: Boolean,
            value: false
        },
        search: {
            type: Boolean,
            value: false
        },
        fixed: {
            type: Boolean,
            value: false
        },
        isShow: {
            type: Boolean,
            value: false
        },
        shareShow: {
            type: Boolean,
            value: false
        },
        bgColor: {
            type: String,
            value: "transparent"
        },
        bgIcon: {
            type: String,
            value: ""
        }
    },
    /**
     * 组件的初始数据
     */
    data: {
        height: "",
        paddingTop: "",
        paddingRight: "",
        navHeight: "",
        unit: "px",
        isShow: true
    },
    ready() {
        var headerStyle = tools.getHeaderStyle();
        this.setData(headerStyle)
        var pagelist = getCurrentPages();
        if (pagelist.length <= 1) {
            // this.setData({
            //     isShow: false
            // })
        }
    },
    /**
     * 组件的方法列表
     */
    methods: {
        searchTap() {
            wx.navigateTo({
                url: '/pages/productSelection/search/search',
            })
        },
        home() {
            wx.switchTab({
                url: '/pages/home/home',
            })
        },
        back() {
            wx.navigateBack();
        },
        shareTap() {
            this.triggerEvent('share')
        },
    }
})